package com.member.shop.service.impl;

import java.util.Arrays;
import java.util.List;

import com.member.common.utils.DateUtils;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import com.member.shop.mapper.SysBizRaffleQuotaMapper;
import com.member.shop.domain.SysBizRaffleQuota;
import com.member.shop.service.ISysBizRaffleQuotaService;

/**
 * 抽奖额度Service业务层处理
 *
 * @author lixinchen
 * @date 2024-11-09
 */
@Service
public class SysBizRaffleQuotaServiceImpl extends ServiceImpl<SysBizRaffleQuotaMapper, SysBizRaffleQuota> implements ISysBizRaffleQuotaService {
    @Resource
    private SysBizRaffleQuotaMapper sysBizRaffleQuotaMapper;

    /**
     * 查询抽奖额度
     *
     * @param id 抽奖额度主键
     * @return 抽奖额度
     */
    @Override
    public SysBizRaffleQuota selectSysBizRaffleQuotaById(Long id) {
        return sysBizRaffleQuotaMapper.selectById(id);
    }

    /**
     * 查询抽奖额度列表
     *
     * @param queryWrapper 抽奖额度
     * @return 抽奖额度
     */
    @Override
    public List<SysBizRaffleQuota> selectSysBizRaffleQuotaList(LambdaQueryWrapper<SysBizRaffleQuota> queryWrapper) {
        return sysBizRaffleQuotaMapper.selectList(queryWrapper);
    }

    /**
     * 新增抽奖额度
     *
     * @param sysBizRaffleQuota 抽奖额度
     * @return 结果
     */
    @Override
    public int insertSysBizRaffleQuota(SysBizRaffleQuota sysBizRaffleQuota) {
        sysBizRaffleQuota.setCreateTime(DateUtils.getNowDate());
        return sysBizRaffleQuotaMapper.insert(sysBizRaffleQuota);
    }

    /**
     * 修改抽奖额度
     *
     * @param sysBizRaffleQuota 抽奖额度
     * @return 结果
     */
    @Override
    public int updateSysBizRaffleQuota(SysBizRaffleQuota sysBizRaffleQuota) {
        sysBizRaffleQuota.setUpdateTime(DateUtils.getNowDate());
        return sysBizRaffleQuotaMapper.updateById(sysBizRaffleQuota);
    }

    /**
     * 批量删除抽奖额度
     *
     * @param ids 需要删除的抽奖额度主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRaffleQuotaByIds(Long[] ids) {
        return sysBizRaffleQuotaMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除抽奖额度信息
     *
     * @param id 抽奖额度主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRaffleQuotaById(Long id) {
        return sysBizRaffleQuotaMapper.deleteById(id);
    }

    @Override
    public List<SysBizRaffleQuota> selectSysBizRaffleQuotaList(SysBizRaffleQuota sysBizRaffleQuota) {
        return sysBizRaffleQuotaMapper.selectSysBizRaffleQuotaList(sysBizRaffleQuota);
    }
}
